package database

import (
	"database/sql"
	_ "github.com/go-sql-driver/mysql"
	"log"
)

var SqlDB *sql.DB

func init() {
	println("  初始化 SqlDB 了 ")
	var dbName = "test:qsou@123456@tcp(dawang.com:3406)/test_top?parseTime=true"
	var err error
	SqlDB, err = sql.Open("mysql", dbName)
	if err != nil {
		log.Fatal(err.Error())
	}

	log.Printf("当前Db链接配置:  ", dbName)
	err = SqlDB.Ping()
	if err != nil {
		log.Fatal(err.Error())
	}
}
